package com.woniuxy.threeproject.end_water_project_user.commons;

import com.woniuxy.threeproject.end_water_project_user.exception.EndWaterRuntimeException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserChekeUtile {

    public static void chekeCard(String userCard){
        if (null == userCard) {
            log.warn("账号为空：{}",userCard);
            throw new EndWaterRuntimeException("卡号不能为空");
        }
        if(userCard.length() < 4){
            log.warn("账号小于4位：{}",userCard);
            throw new EndWaterRuntimeException("卡号长度不正确 > 4位");
        }
    }
    public static void chekeIdCard(String idCard){
        if (null == idCard){
            log.warn("验证号为空：{}",idCard);
            throw new EndWaterRuntimeException("验证号不能为空");
        }
        if(idCard.length() != 6){
            log.warn("验证号不是6位：{} {}",idCard,idCard.length());
            throw new EndWaterRuntimeException("验证号为身份证后6位");
        }
    }
    public static void cheke(String card,String idCard){
        chekeCard(card);
        chekeIdCard(idCard);
    }
}
